#include <stdio.h>
#include <string.h>
int funct(char *a)
{
    int len=strlen(a);
    char *p=a,*q=a+len-1;
    while(p < q){//p为a的首地址，q为a的尾地址
        if(*q == ' '){//指针q向前移动，如果遇到空格继续减1;
            q--;
            continue;
        }
        if(*p == ' '){//指针p向后移动，如果遇到空格继续加1;{
            p++;
            continue;
        }
        if(*q == *p){//如果两个指针代表的字符相等，则向中间同时移动;
            p++;
            q--;
        }
        else
            return 0;
    }
    return 1;
}

char get_str(char *str)
{
    char temp;
    int i = 0;
    while(scanf("%c",&temp))
    {
        if(temp == '\n')break;
        else 
        {
            str[i] = temp;
            i++;
        }
    }
    str[i] = '\0';
}

int main()
{
    char a[111000];
    char times_flag[1000] = {0};
    int times = 0;
    while(1)
    {
        // scanf("%[^n]",a);
        get_str(a);
        if(strcmp(a,"2022")==0){
            break;
        }
        if(funct(a))
            times_flag[times] = 1; 
            // printf("YES\n");
        else
            times_flag[times] = 2;
            // printf("NO\n");
        times ++;
    }
    for(int i = 0;i<times;i++)
    {
        if(times_flag[i] == 1)
            printf("YES\n");
        else if(times_flag[i] == 2)
            printf("NO\n");
    }
    return 0;
}